package cn.itcast.hotel.Web;

import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import cn.itcast.hotel.service.impl.HotelService;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author 嘉德罗斯
 * @date 2021/11/11
 */
@RequestMapping("/hotel")
@RestController
public class HotelController {

    @Autowired
    private IHotelService ihotelService;



    @PostMapping("/list")
    public PageResult findHotel(@RequestBody RequestParams requestParams){
    PageResult pageResult = ihotelService.findHotel(requestParams);
    return pageResult;
    }


    @PostMapping("/filters")
    public Map<String,List<String>> filters(@RequestBody RequestParams requestParams){
        Map<String,List<String>> map = ihotelService.filters(requestParams);
        return map;
    }

    @GetMapping("/suggestion")
    public List<String> suggestion(@RequestParam("key") String key){
        List<String> list = ihotelService.suggestion(key);
        return list;
    }

}
